package com.feihong.txgw.tx_model;

import com.feihong.txgw.inter.contract.login.ILoginContract;
import com.feihong.txgw.utils.helper.RxHelper;
import com.feihong.txgw.utils.manage.RetrofitManager;

import io.reactivex.Observable;

/**
 * @Author wangziheng
 * @ProjectName txgw_app
 * @ClassName LoginMainModel
 * @package com.feihong.txgw.tx_model
 * @data 2018/5/7 18:45
 * @Describe
 * @Change
 */
public class LoginMainModel implements ILoginContract.ILoginMainModel {

    public static LoginMainModel create(){
        return new LoginMainModel();
    }

    @Override
    public Observable<String> getDeliverAdr() {
        return RetrofitManager.getInstance().getUserDeliveryAdr().compose(RxHelper.<String>rxSchedulerHelper());
    }

    @Override
    public Observable<String> userLogin(String telNum, String code) {
        return RetrofitManager.getInstance().userLogin(telNum, code).compose(RxHelper.<String>rxSchedulerHelper());
    }

    @Override
    public Observable<String> getTelCode(String telNum, String type) {
        return RetrofitManager.getInstance().sendTelCodeToLogin(telNum, type).compose(RxHelper.<String>rxSchedulerHelper());
    }
}
